#ifndef GLOBALSTATES_H
#define GLOBALSTATES_H
#include "result.h"
#include "vector3.h"
#include "voxel.h"
#include "rendermanager.h"
#include <set>
#include "Drawing.h"

#define ADD_R 0
#define ADD_G 0
#define ADD_B 200

#define ERASE_R 200
#define ERASE_G 0
#define ERASE_B 0

enum FIXED_AXES {NO_AXIS = 0, XAXIS =1, YAXIS=2, ZAXIS=4};

class GlobalStates
{

    /*
      What this will store:
      1. Colours
      2. Objects - when saved, should transfer out to a text file, and when program
      is reopened, should transfer back in again.
      3. Selections - temporary, should have an option that makes it a group

      */

    GlobalStates();
    colour RGB;
    int screenWidth;
    int screenHeight;
    set<vector3<int> > selection;
    colour colorMask(colour &c);
public:

    static GlobalStates* getInstance();
    Result setRGB(char R, char G, char B);
    colour getRGB();
    int getScreenWidth();
    int getScreenHeight();
    void setScreenResolution(int w,int h);

    Result addVoxelToSelection(int i, int j, int k);
    Result deleteVoxelFromSelection(int i, int j, int k);
    void clearSelection();
    bool isSelectionEmpty();
    bool findInSelection(int i, int j, int k);
    const set<vector3<int> >& getSelection();
    Result changeAllSelectedVoxelsColour(colour c);

    //utility methods
    static bool isInAcceptableRange(vector3<int> coords);
    static bool isInAcceptableRange(FIXED_AXES axis, int number);



};
inline
colour GlobalStates::getRGB(){
    return RGB;
}

#endif // GLOBALSTATES_H
